package cn.rkylin.oms.aftersale.sysreturn.dao;

import cn.rkylin.oms.aftersale.sysreturn.domain.SysReturn;
import cn.rkylin.oms.aftersale.sysreturn.vo.SysReturnVO;
import com.github.pagehelper.PageInfo;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public interface ISysReturnDAO {
    int deleteByPrimaryKey(String returnId);

    int insert(SysReturn record);

    int insertSelective(SysReturn record) throws Exception;

    public SysReturnVO selectByPrimaryKey(String returnId) throws Exception;

    int updateByPrimaryKeySelective(SysReturn record);

    int updateByPrimaryKey(SysReturn record);

    /**
     * updateBySelective:局部更新退货单.  退货单更新/删除操作. <br/>
     * 如果operable为y，则添加“可操作”作为查询条件.<br/>
     *
     * @param record
     * @return
     * @throws Exception
     * @author zhanghao
     */
    int updateBySelective(SysReturnVO record) throws Exception;

    /**
     * selectBySelectiveValue:条件查询退货单. <br/>
     *
     * @param sysReturnVO
     * @return
     * @throws Exception
     * @author zhanghao
     */
    List<SysReturnVO> selectBySelectiveValue(SysReturnVO sysReturnVO) throws Exception;

    /**
     * cancelSysReturn4Ext:作废三方仓退货单. <br/>
     *
     * @param param
     * @return
     * @throws Exception
     * @author zhanghao
     */
    int cancelSysReturn4Ext(SysReturnVO param) throws Exception;

    /**
     * cancelSysReturn4Local:作废本地仓退货单. <br/>
     *
     * @param param
     * @return
     * @throws Exception
     * @author zhanghao
     */
    int cancelSysReturn4Local(SysReturnVO param) throws Exception;

    /**
     * updateUnApproveSysReturn:将符合条件的退货单设置为未审核. <br/>
     *
     * @param param
     * @return
     * @throws Exception
     * @author zhanghao
     */
    int updateUnApproveSysReturn(SysReturnVO param) throws Exception;

    /**
     * selectBySelectiveValueExtend:条件查询退货单. <br/>
     *
     * @param queryParam
     * @return
     * @throws Exception
     * @author zhanghao
     */
    List<SysReturnVO> selectBySelectiveValueExtend(SysReturnVO queryParam) throws Exception;

    /**
     * 按条件查询退货单信息列表(分页)
     *
     * @param page
     * @param length
     * @param queryParamVO
     * @return
     * @throws Exception
     */
    public PageInfo<SysReturnVO> pageSelectByCondition(int page, int length, SysReturnVO queryParamVO) throws Exception;

    /**
     * 获取退货单各个Tab页单据数量
     *
     * @param queryParamVO
     * @return
     * @throws Exception
     */
    public List<HashMap> selectStateCount(SysReturnVO queryParamVO) throws Exception;

    /**
     * 通过ID获取单条退货单信息
     *
     * @param returnId
     * @return
     * @throws Exception
     */
    public SysReturnVO selectByPrimaryKeyOnly(String returnId) throws Exception;

    /**
     * 通过来源ID获取退货单信息
     *
     * @param sourceId
     * @return
     * @throws Exception
     */
    public List<SysReturnVO> selectBySourceID(String sourceId) throws Exception;

    /**
     * selectReturnCountByRefundId:根据退款单ID获取已完成的退货单数量. <br/>
     *
     * @param refundId
     * @return
     * @throws Exception
     * @author zhanghao
     */
    Integer selectReturnCountByRefundId(String refundId) throws Exception;

    /**
     * 判断 仓库入库单号 是否存在
     *
     * @param sysReturn
     * @return
     * @throws Exception
     */
    public List<SysReturnVO> selectSysReturnWmsStockinCode(SysReturn sysReturn) throws Exception;

    /**
     * getUnGoingCount:获取进行中的单据数量. <br/>
     *
     * @author zhanghao
     * @param paramMap
     * @return
     * @throws Exception
     */
    int getUnGoingCount(Map<String, String> paramMap) throws Exception;

}